package com.wyiot.pet.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.wyiot.core.enums.TransportationEnum;
import com.wyiot.core.enums.WaybillStatusEnum;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 运输消息实体类
 *
 * @author yly
 * @since 2022年04月11日
 */
@Data
@TableName("waybill_message")
@Alias("waybillMessage")
@NoArgsConstructor
public class WayBillMessageDO {
    /**
     * 运单消息主键
     */
    @TableId(type = IdType.AUTO)
    private Long wayBillMessageId;
    /**
     * 运单id
     */
    private Long wayBillId;
    /**
     * 运输类型
     */
    private TransportationEnum transportationType;
    /**
     * 车次
     */
    private String carNumber;
    /**
     * 工作人员id
     */
    private Long workerId;
    /**
     * 工作人员姓名
     */
    private String workerName;
    /**
     * 工作人员电话
     */
    private String workerPhone;
    /**
     * 工作网点
     */
    private String workArea;
    /**
     * 始发站
     */
    private String departureStation;
    /**
     * 终点站
     */
    private String destination;
    /**
     * 运单消息对应状态
     */
    private WaybillStatusEnum wayBillState;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    public WayBillMessageDO(Long wayBillId, TransportationEnum transportationType,
                            String carNumber, Long workerId, String workerName, String workArea,
                            String departureStation, String destination, WaybillStatusEnum wayBillState) {
        this.wayBillId = wayBillId;
        this.transportationType = transportationType;
        this.carNumber = carNumber;
        this.workerId = workerId;
        this.workerName = workerName;
        this.workArea = workArea;
        this.departureStation = departureStation;
        this.destination = destination;
        this.wayBillState = wayBillState;
    }

    public WayBillMessageDO(Long wayBillId, TransportationEnum transportationType,
                            Long workerId, String workerName, String workerPhone, String workArea, WaybillStatusEnum wayBillState) {
        this.wayBillId = wayBillId;
        this.transportationType = transportationType;
        this.workerId = workerId;
        this.workerName = workerName;
        this.workerPhone = workerPhone;
        this.workArea = workArea;
        this.wayBillState = wayBillState;
    }
}
